import { theme } from '@/app/config/theme';
import TabBarBox from '@/pages/tabbarBox';
import 'antd/dist/antd.less';
import React from 'react';
import { ThemeProvider } from 'styled-components';
import { IRouteComponentProps } from 'umi';
import './antdMobila.less';
export default function Layout({ children }: IRouteComponentProps) {
  console.log(children);

  // console.log(children.props.location.pathname);
  const ULR_NO_LAYOUT = [
    '/',
    '/home',
    '/savingsBank',
    '/quotation',
    '/personal',
  ]; // 判断在哪几个路由下需要出现底部导航
  const renderBody = () => {
    // const {
    //   location: { pathname },
    //   children,
    // } = props;
    if (ULR_NO_LAYOUT.includes(children.props.location.pathname)) {
      // 需要tabbar的页面
      return <TabBarBox {...children} />;
    }
    return <React.Fragment>{children}</React.Fragment>;
  };
  return (
    // 注入主题样式
    <ThemeProvider theme={theme}>
      <React.Fragment>{renderBody()}</React.Fragment>
      {/* {children} */}
    </ThemeProvider>
  );
}
